//package com.hellowx_ssm;
//
//import com.alibaba.fastjson.support.config.FastJsonConfig;
//import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
//import org.springframework.context.annotation.ComponentScan;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.context.annotation.FilterType;
//import org.springframework.http.converter.HttpMessageConverter;
//import org.springframework.stereotype.Controller;
//import org.springframework.web.servlet.config.annotation.*;
//
//import java.nio.charset.Charset;
//import java.util.List;
//
///**
// * Created by IntelliJ IDEA.
// *
// * @author MagicMushroom
// * @date 2021/6/25
// */
//@Configuration
//@ComponentScan(basePackages = "com.hellowx_ssm.controller",
//        useDefaultFilters = false,
//        includeFilters = {@ComponentScan.Filter(type = FilterType.ANNOTATION,
//                classes = Controller.class),
//                @ComponentScan.Filter(type = FilterType.ANNOTATION,
//                        classes = Configuration.class)})
//public class SpringMVCConfig extends WebMvcConfigurationSupport {
//
//    //把根目录下的静态资源放开，不过访问静态资源时，请求路径前要加上“/js/”
//    @Override
//    protected void addResourceHandlers(ResourceHandlerRegistry registry) {
//        registry.addResourceHandler("/js/**").addResourceLocations("classpath:/");
//    }
//
//    //给访问jsp的请求加上前缀（“/”） 和后缀 (".jsp")
//    @Override
//    protected void configureViewResolvers(ViewResolverRegistry registry) {
//        registry.jsp("/",".jsp");
//    }
//
//    //这里表示，访问/hello3路径后，进入名为hello的视图去
//    @Override
//    protected void addViewControllers(ViewControllerRegistry registry) {
//        registry.addViewController("/hello3").setViewName("index");
//    }
//
//
//    //加了fastjson的依赖后，这里配置引用fastjson，以及设置编码
//    @Override
//    protected void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
//
//        FastJsonHttpMessageConverter converter = new FastJsonHttpMessageConverter();
//        converter.setDefaultCharset(Charset.forName("UTF-8"));
//
//        FastJsonConfig config = new FastJsonConfig();
//        config.setCharset(Charset.forName("UTF-8"));
//
//        converter.setFastJsonConfig(config);
//
//        converters.add(converter);
//    }
//}
//
